package com.example.allplan.Fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.allplan.MyApplication;
import com.example.allplan.R;
import com.example.allplan.StaticFangfa.BiaoQingZhuanHuan;
import com.nightonke.jellytogglebutton.JellyToggleButton;
import com.nightonke.jellytogglebutton.State;

public class SheZhiFragment extends BaseFragment{
    View mview;
    TextView biaoqing;
    JellyToggleButton mswitch;
    MyApplication myapp;
    @Override
    protected void lazyLoadData() {

    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
         super.onCreateView(inflater, container, savedInstanceState);
         myapp=MyApplication.getInstance();
         mview=inflater.inflate(R.layout.she_zhi_fragmen_layout,container,false);
         init();
         return mview;
    }
    void init(){
        biaoqing=mview.findViewById(R.id.she_zhi_biao_ti_lan_xian_shi_biao_qing_TextView);
        biaoqing.setText(BiaoQingZhuanHuan.biao_qing_int_to_string(128295));
        mswitch=mview.findViewById(R.id.shuang_ji_tui_chu_kai_guan);
        mswitch.setChecked(myapp.shifoushuangji);
        mswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    myapp.shifoushuangji=true;
                    myapp.putSH_Boolean(myapp.SHUANG_JI_SHARE_NAME,true);
                }else {
                    myapp.shifoushuangji=false;
                    myapp.putSH_Boolean(myapp.SHUANG_JI_SHARE_NAME,false);
                }
            }
        });
    }
}
